{% load common_tags %}
{% load navigation_tags %}

{% if link|common_get_type == "<class 'mayan.apps.navigation.classes.Menu'>" %}
    <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">
            {% if link.icon_class %}{{ link.icon_class.render }}{% endif %}
            {{ link.label }}
            <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
            {% navigation_resolve_menu name=link.name as sub_menus_results %}
            {% for sub_menu_results in sub_menus_results %}
                {% for link_group in sub_menu_results.link_groups %}
                    {% with '' as li_class_active %}
                    {% with link_group.links as object_navigation_links %}
                        {% include 'navigation/generic_navigation.html' %}
                    {% endwith %}
                    {% endwith %}
                {% endfor %}
            {% endfor %}
        </ul>
    </li>
{% else %}
    {% if as_li %}
        <li class="{% if link.active and li_class_active %}{{ li_class_active }}{% endif %}">
    {% endif %}
        {% include link_template|default:'navigation/generic_link_instance.html' %}
    {% if as_li %}
        </li>
    {% endif %}
{% endif %}
